var dao = require('./dao')
const { json } = require('express')

var homeDAL = {
    article:function(article,cb){
        var sql = 'select * from topic  where tid<8'
        var params=[]
        dao(sql,params,function(err,results){
            if (err) {
                console.log('没查到')
                cb(err, null)
            } else {
                console.log('查到了')
                cb(null, results)
            }
        })
    },
    topic:function(topic,cb){
        var sql = 'select * from user  join article on user.uid=article.uid where user.uid<2'
        var params=[]
        console.log(params)
        dao(sql, params, function (err, results) {
            if (err) {
                console.log('没查到')
                cb(err, null)
            } else {
                console.log('查到了')
                cb(null, results)
            }
        }) 
    }
}
module.exports = homeDAL